using System.Collections.Generic;
using System.IO;
using System.Web;

namespace ThunderJob.Bootstrapper.Extensions
{
    public static class HttpRequestExtensions
    {
        static List<string> fileExtensionsToIgnore = new List<string>
            { 
                ".css", 
                ".js",
                ".jpg",
                ".gif",
                ".png",
                ".html",
                ".htm",
                ".pdf",
                ".ico",
                ".web",
            };

        public static bool IsStaticFile(this HttpRequest request)
        {
            var file = new FileInfo(request.Url.Segments[request.Url.Segments.Length - 1]);
            string extension = file.Extension.ToLowerInvariant();

            return fileExtensionsToIgnore.Contains(extension);
        }
    }
}